<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jstl标签库</title>
</head>
<body>
	<%
		int flag = 1;
		// 缓存到request中
		request.setAttribute("flag", flag);

		// 缓存一个数组
		String atts[] = new String[5];
		atts[0] = "hello";
		atts[1] = "this";
		atts[2] = "is";
		atts[3] = "a";
		atts[4] = "girl";
		request.setAttribute("atts", atts);

		Map map = new HashMap();
		map.put("a", "12345");
		map.put("b", "abcde");

		List lst = new ArrayList();
		lst.add(map);

		Map map2 = new HashMap();
		map2.put("aa", "123459999");
		map2.put("bb", "abcde9999");
		lst.add(map2);

		// 缓存到session中
		request.getSession().setAttribute("lst", lst);
	%>
	<c:set var="userName" value="张三" scope="request"></c:set>
	<c:out value="${requestScope.userName}"></c:out>
	<c:out value="这是jstl的out标签输出的内容"></c:out>
	<c:if test="${requestScope.flag > 0 }">
		<p>if条件成立时的显示</p>
	</c:if>

	<c:forEach begin="1" end="10" var="eachVale">
		<c:out value="${eachVale}"></c:out>
	</c:forEach>
	<br>
	<c:forEach items="${requestScope.atts }" var="eachV">
		<c:out value="${eachV}"></c:out>
	</c:forEach>

	<br>

	<c:forEach items="${sessionScope.lst }" var="eachV" varStatus="st">
		<c:out value="${st.index+1 }"></c:out>
		<c:forEach items="${eachV }" var="subEachV">
			<c:out value="${subEachV.key }"></c:out>--
			<c:out value="${subEachV.value }"></c:out>
		</c:forEach>
		<br>
	</c:forEach>
</body>
</html>